#include "system_try.h"


int main(void){
    printf("\e[1;34m本程序将跑一辆小火车, 请先输入密码安装\e[0m\n");

    pid_t son = fork();
    if (son < 0)
        fprintf(stderr, "error\n");

    if (son == 0){
        if (! system("sudo apt-get install sl"))
            return 0;
        else
            fprintf(stderr, "error\n");
    }
    else{
        wait(NULL);
        printf("\e[1;34m安装成功\e[0m\n");
        for (int i=0; i<5; i++){
            sleep(1);
            printf("%d...\n", 5-i);
        }
        if (! system("sl"))
            return 0;
        else
            fprintf(stderr, "error\n");
    }
    printf("\e[1;34m跑完了\e0m\n");

    return 0;
}